/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package aptech.semester.code.renderer;

import java.awt.Component;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableCellRenderer;
import org.apache.commons.lang3.StringUtils;

/**
 *
 * @author vi
 */
public class TableCellTextFieldRenderer extends JTextField implements TableCellRenderer{

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        
        if (value != null && StringUtils.isBlank(value.toString())) {
            setText(value.toString());
        } else {
            setText("0");
        }
        return this;
    }
    
}
